#include "Shm.hpp"
#include "Fifo.hpp"

int main()
{
    Shm shm(pathname, projid, CREATER);
    // sleep(5);
    // shm.Attr();
    // 创建管道文件
    NamedFifo fifo(PATH, FILENAME);
    FileOper readerfile(PATH, FILENAME);
    readerfile.OpenForRead();

    char *mem = (char *)shm.VirtualAddr();
    while (true)
    {
        if (readerfile.Wait()) // 默认阻塞
        {
            printf("%s\n", mem);
        }
        else
        {
            break;
        }
    }

    readerfile.Close();
    std::cout << "server end normal!" << std::endl;
    return 0;
}
